﻿<!DOCTYPE html>
<html lang="en">

<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" type="text/css" href="../../css/cloud-admin.css">
	<link rel="stylesheet" type="text/css" href="../../css/themes/default.css" id="skin-switcher">
	<link rel="stylesheet" type="text/css" href="../../css/responsive.css">

	<link href="../../font-awesome/css/font-awesome.min.css" rel="stylesheet">
	<!-- file-input -->
	<link rel="stylesheet" type="text/css" href="../../js/file-input/fileinput.css" />
	<!-- SELECT2 -->
	<link rel="stylesheet" type="text/css" href="../../js/select2/select2.min.css" />
	<!-- UNIFORM -->
	<link rel="stylesheet" type="text/css" href="../../js/uniform/css/uniform.default.min.css" />
	<!-- datatable -->
	<link rel="stylesheet" href="../../js/datatables/datatable.css">
	<link rel="stylesheet" type="text/css" href="../../css/animatecss/animate.min.css" />
	<!-- WIZARD -->
	<link rel="stylesheet" type="text/css" href="../../js/bootstrap-wizard/wizard.css" />

	<style type="text/css">
		.in_A .swiper-container {
			width: 100%;
			height: auto;
		}

		.in_B {
			padding: 1.125rem;
			overflow: hidden;
		}

		.in_B li {
			width: 25%;
			display: block;
			float: left;
		}

		.in_C {
			height: auto;
			width: 100%;
			overflow: hidden;
		}

		.in_C dt {
			/*width:7.075rem;*/
			width: 37.733%;
			position: relative;
			float: left;
		}

		.in_C dt .seckill {
			position: absolute;
			top: 0.5rem;
			left: 0.5rem;
		}

		.in_C dt .seckill .time {
			font-size: 0.75rem;
			color: #333;
			padding-left: 0.2rem;
		}

		.in_C dt .seckill .seck {
			font-size: 0.55rem;
		}

		.in_C dt .seckill .seck span {
			color: #808080;
			padding-left: 0.2rem;
		}

		.in_C dt .seckill .seck .sec {
			width: 3.5rem;
			height: 0.875rem;
			background: #fff;
			border-radius: 0.75rem;
			border: #7a6a56 solid 2px;
			font-size: 0.65rem;
			text-align: center;
			line-height: 0.875rem;
			color: #7a6a56;
			margin-top: 0.1rem;
		}

		.in_C dd {
			/*width:11.675rem;*/
			width: 62.266%;
			float: left;
		}

		.in_C dd p {
			overflow: hidden;
		}

		.in_C dd p:first-child {
			width: 100%;
		}

		.in_C dd p span {
			float: left;
		}

		.in_C dd p:last-child span:first-child {
			width: 49.892%;
		}

		.in_C dd p:last-child span:last-child {
			width: 50.107%;
		}

		.in_D {
			padding-bottom: 1.5rem;
		}

		.in_D .in_D_tit {
			height: 2.25rem;
			line-height: 2.25rem;
			font-size: 0.75rem;
			text-align: center;
			display: block;
			color: #333;
		}

		.in_D .in_D_lst {
			width: 100%;
			border-top: #eee solid 0.05rem;
			overflow: hidden;
		}

		.in_D .in_D_lst li {
			border-bottom: #eee solid 0.05rem;
			width: 25%;
			float: left;
		}

		.in_D .in_D_lst li a {
			display: block;
			width: 100%;
			border-left: #eee solid 0.05rem;
		}

		.in_D .in_D_lst li:first-child a {
			border-left: #fff solid 0.05rem;
		}

		.in_D .in_D_lst li:nth-child(5) a {
			border-left: #fff solid 0.05rem;
		}

		.in_D .in_D_lis {
			width: 100%;
			border-top: #eee solid 0.05rem;
			overflow: hidden;
		}

		.in_D .in_D_lis li {
			border-bottom: #eee solid 0.05rem;
			width: 50%;
			float: left;
			/*height:7.25rem;*/
			display: block;
		}

		.in_D .in_D_lis li a {
			border-left: #eee solid 0.05rem;
			background: url(../images/350.jpg) #f9f9f9 center center no-repeat;
			width: 100%;
			height: 100%;
			display: block;
			background-size: 4rem;
			-moz-box-sizing: border-box;
			-webkit-box-sizing: border-box;
			-webkit-box-sizing: border-box;
			-o-box-sizing: border-box;
			-ms-box-sizing: border-box;
		}

		.group-goods {}

		.group-goods-banner {
			height: 8.75rem;
		}

		.group-goods-lst {
			overflow: hidden;
			padding: 10px;
		}

		.group-goods-lst li {
			width: 142px;
			padding: 10px 10px 10px 10px;
			float: left;
		}

		.category-goods-lst {
			overflow: hidden;
			padding: 10px;
		}

		.category-goods-lst li {
			width: 80px;
			padding: 10px 10px 10px 10px;
			float: left;
		}

		.group-goods-lst li h3 {
			font-size: 0.6rem;
			color: #808080;
			position: relative;
			padding-top: 0.5rem;
		}

		.group-goods-lst li h3 b {
			color: #333;
			font-size: 0.7rem;
			padding-left: 0.15rem;
		}

		.group-goods-lst li h3 span {
			width: 1.425rem;
			height: 0.575rem;
			display: block;
			position: absolute;
			right: 0;
			top: 0.7rem;
		}

		img {
			width: 100%
		}

		ol li {
			width: 171px;
			height: 171px;
		}
		.waterfall img {
			width: 50%;
			float: left;
		}
		.list-item  img{
			width: 33.33%;
			float: left;
		}
		.shoesHats-list img,
		.HomeFurnishing-list img{
			width: 33.33%;
			float: left;
		}
	</style>

</head>

<body>
	<header class="navbar clearfix" id="header"> </header>

	<!-- PAGE -->
	<section id="page">
		<!-- SIDEBAR -->
		<div id="sidebar" class="sidebar">
			<div class="sidebar-menu nav-collapse">

				<ul>


				</ul>

			</div>

		</div>
		<!-- /SIDEBAR -->
		<div id="main-content">
			<!-- SAMPLE BOX CONFIGURATION MODAL FORM-->
			<div class="modal fade" id="box-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
				aria-hidden="true">
				<div class="modal-dialog">
					<form id="form_focus">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">&times;</button>
								<h4 class="modal-title">维护图片</h4>
							</div>
							<div class="modal-body">

								<div class="row" style="height: 100px">
									<label class="control-label col-md-3" style="line-height: 34px;">
										<span class="required">*</span>
										图片：
									</label>
									<form>
										<div class="col-md-8">
											<div hidden-image></div>
											<div class="fileinput fileinput-new" data-provides="fileinput">
												<div class="image_preview_list" style="float: left;" id="imgs">
													<div class="fileinput-preview thumbnail image_preview_default"
														data-trigger="fileinput" style="width: 120px; height: 90px;">
													</div>
												</div>
												<div style="float: left; margin-left: 5px; padding-top: 23px;"
													class="addnewimg" id="f_span">
													<span class="btn btn-default btn-file" id="fir">
														<span class="fileinput-new" id="two">上传图片</span>
														<span class="fileinput-exists">Change</span>
														<input type="file" name="uploadFile"
															upload-file="imageUrlProduct">
													</span>
													<div class="progress progress-striped active" role="progressbar"
														aria-valuemin="0" aria-valuemax="100"
														style="margin-bottom: 0px; margin-top: 10px;">
														<div class="progress-bar progress-bar-success"
															style="width: 0%;"></div>
													</div>
												</div>

											</div>


										</div>
									</form>

								</div>
								<div class="row">
									<label class="control-label col-md-3" style="line-height: 34px;">
										<span class="required">*</span>
										链接：
									</label>
									<div class="col-md-6">
										<textarea class="form-control" row=3 cols=15 name="linkUrl"
											placeholder="请输入链接Url" style="resize: none" maxlength="200"></textarea>

									</div>
								</div>


							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
								<button type="button" class="btn btn-primary bt-save">保存</button>
							</div>
						</div>
					</form>

				</div>
			</div>
			<!-- /SAMPLE BOX CONFIGURATION MODAL FORM-->
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">

						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- STYLER -->

									<!-- /STYLER -->
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="index.html">首页</a>
										</li>
										<li>
											<a href="#">商品管理</a>
										</li>
										<li>维护商品</li>
									</ul>
									<!-- /BREADCRUMBS -->

								</div>
							</div>
						</div>
						<!-- 头图start -->
						<div class="row " style="margin-left: 20px;width:414px">
							<img name="brand" src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/b7bcf632-03ca-4661-a827-648cb393d1b5.png"></img>
						</div>
						<!-- 头图end -->
						<!-- 瀑布流 -->
						<div class="row waterfall" style="margin-left: 20px;width:414px">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/fb73ea68-cece-4e59-b13f-8cb53992b1d3.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/b64c3ce1-d768-4ae8-ad0b-5fc0588ca12c.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/6b4410ce-ed64-4320-97df-69745cffacd9.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/5bbe2f89-c756-4682-b82c-ed2bd01e17f5.png">
						</div>
						<!-- 瀑布流end -->
						
						<div class="row " style="margin-left: 20px;width:414px">
							<img name="agent-vip" src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/cec94303-b349-416f-8041-188fa8e5d134.png"></img>
						</div>
						<!-- 分类 -->
						<div class="row list-item" style="margin-left: 20px;width:414px">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
							<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/3ea73873-1926-4415-aa30-c0b78288b11d.png">
						</div>
						<!-- 分类end -->
						<!-- 有机棉 -->
						<div class="row cotton" style="margin-left: 20px;width:414px">
							<div class="cotton-tip">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/a4448c7b-120a-4fdc-b54b-804cd2fe5781.jpg">
							</div>
							<div class="cotton-list">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/6fb8c12d-d5e8-4160-bff4-d7847cc6a79c.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/09563991-6baf-44be-a0f8-2fb313577c8c.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/d6278e4a-3bb6-4532-9ca6-4b451ee1b362.jpg">
							</div>
						</div>
						<!-- 安心婴童 -->
						<div class="row baby" style="margin-left: 20px;width:414px">
							<div class="baby-tip">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/7554e47b-25cb-4436-91ce-4ef6a48aba76.jpg">
							</div>
							<div class="baby-list">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/d12c3a06-0f66-4c2e-9689-5177033ecb00.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/38da7272-2c13-4690-90ad-48685fa3b7ef.jpg">
							</div>
						</div>
						<!-- 鞋帽配饰 -->
						<div class="row shoesHats" style="margin-left: 20px;width:414px">
							<div class="shoesHats-tip">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/d96eca25-99aa-4291-a23e-1ff81729d93d.jpg">
							</div>
							<div class="shoesHats-body">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190910/9a3c350e-a1c9-4142-9a44-f9adb8f0d838.jpg">
							</div>
							<div class="shoesHats-list">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/916325d2-2a8f-416b-89a6-ddde4e06b5a9.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/916325d2-2a8f-416b-89a6-ddde4e06b5a9.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/916325d2-2a8f-416b-89a6-ddde4e06b5a9.jpg">
							</div>
						</div>
						<!-- 家居 -->
						<div class="row HomeFurnishing" style="margin-left: 20px;width:414px">
							<div class="HomeFurnishing-tip">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/d96eca25-99aa-4291-a23e-1ff81729d93d.jpg">
							</div>
							<div class="HomeFurnishing-body">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190910/9a3c350e-a1c9-4142-9a44-f9adb8f0d838.jpg">
							</div>
							<div class="HomeFurnishing-list">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/916325d2-2a8f-416b-89a6-ddde4e06b5a9.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/916325d2-2a8f-416b-89a6-ddde4e06b5a9.jpg">
								<img src="http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20190909/916325d2-2a8f-416b-89a6-ddde4e06b5a9.jpg">
							</div>
						</div>
						<div>
							<button type="button" class="btn btn-success bt_review"
								style="margin-top:100px;height:34px">保存</button>
						</div>
					</div>

				</div>
			</div>
		</div>
		</div>
	</section>
	<div style="display:none" id="divLi">
		<li class="dd-item filter-content" style="float:left"><img class="dd-handle img-responsive"
				src="http://houtai.yiigoo.com/img/default.png?v=122" width="100%">
			<div class="hover-content animated fadeOut" style="display: block;"><a class="btn btn-success hover-link"><i
						class="fa fa-edit fa-1x"></i></a><a class="btn btn-danger hover-link colorbox-button"><i
						class="fa fa-times fa-1x"></i></a></div>
		</li>
	</div>

</body>
<script src="../../js/jquery/jquery-2.0.3.min.js"></script>
<!-- JQUERY UI-->
<script src="../../js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
<!-- BOOTSTRAP -->
<script src="../../bootstrap-dist/js/bootstrap.min.js"></script>
<!-- SLIMSCROLL -->
<script type="text/javascript" src="../../js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="../../js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
<!-- BLOCK UI -->
<script type="text/javascript" src="../../js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
<!--bootbox-->
<script type="text/javascript" src="../../js/bootbox/bootbox.min.js"></script>
<!-- AUTOSIZE -->
<script type="text/javascript" src="../../js/autosize/jquery.autosize.min.js"></script>
<!-- spinner -->
<script src="../../js/spinner/spin.js"></script>
<!-- bootstrap-fileupload -->
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.fileupload.min.js"></script>
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.fileupload-process.min.js"></script>
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.fileupload-validate.min.js"></script>

<!-- INPUT MASK -->
<script type="text/javascript" src="../../js/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>

<!-- SELECT2 -->
<script type="text/javascript" src="../../js/select2/select2.min.js"></script>
<!-- UNIFORM -->
<script type="text/javascript" src="../../js/uniform/jquery.uniform.min.js"></script>
<!-- WIZARD -->
<script src="../../js/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script>
<!-- WIZARD -->
<script src="../../js/jquery-validate/jquery.validate.min.js"></script>
<script src="../../js/jquery-validate/additional-methods.min.js"></script>
<script src="../../js/bootstrap-wizard/form-wizard.js"></script>
<!-- NESTABLE LISTS -->
<script type="text/javascript" src="../../js/nestable/jquery.nestable.min.js"></script>
<!-- COOKIE -->
<script type="text/javascript" src="../../js/jQuery-Cookie/jquery.cookie.min.js"></script>
<!-- CUSTOM SCRIPT -->
<script src="../../js/script.js"></script>
<script src="../../js/common.js"></script>
<script src="../../js/Sortable.min.js"></script>
<script>
	var Home = function () {
		var id = $.getUrlParam('id')
		var flag = $.getUrlParam('flag')
		var target = null;
		var img = {};

		var upLoadImg = function () {

			$("[upload-file=imageUrlProduct]")
				.fileupload(
					{
						url: App.getContextPath()
							+ "admin/file/uploadFile.do",
						formData: {
							fileType: "Mall"
						},
						dataType: 'json',
						acceptFileTypes: /(\.|\/)(gif|jpe?g|png|JPG?g)$/i,
						iframe: true,
						start: function (e) {
							$('.progress').fadeIn(300);
							return true;
						},
						autoUpload: true,
						done: function (e, data) {
							var result = data.result;
							if (result.message != "") {
								$.alert(result.message);
								return false;
							} else {
								var $tr = $(this).closest("form");
								$tr
									.find("[hidden-image]")
									.append(
										"<input type='hidden' name='imagePath' value='" + result.fileUrl + "' />");
								$tr.find(".image_preview_default").html(
									"<img src='" + result.fileUrl + "' />");
								img.imgPath = result.fileUrl;
							}

						},
						progressall: function (e, data) {
							var progress = parseInt(data.loaded
								/ data.total * 100, 10);
							$('.progress .progress-bar').css('width',
								progress + '%');
						}
					}).on('fileuploaddone', function (e, data) {
						$(".progress").fadeOut(300);

					});
		}

		var loadImg = function () {
			$.ajax({
				type: "GET",
				url: App.getContextPath()
					+ "admin/template/findMallTemplateById.do?id=" + id,
				async: true,
				success: function (result) {
					if (result != null) {
						result = result.extra
						var img = JSON.parse(result.imgPath);
						var s = "";
						var temp = {};
						group = img.brand || {};
						$("[name=brand]").attr("src", group.imgPath)
						temp.imgPath = group.imgPath;
						temp.imageType = group.imageType;
						temp.searchKey = group.searchKey;
						temp.linkUrl = group.linkUrl;
						$("[name=brand]").attr("json", JSON.stringify(temp))
						// vip
						group = img.vip || {};
						$("[name='agent-vip']").attr("src", group.imgPath)
						temp.imgPath = group.imgPath;
						temp.imageType = group.imageType;
						temp.searchKey = group.searchKey;
						temp.linkUrl = group.linkUrl;
						$("[name='agent-vip']").attr("json", JSON.stringify(temp))
						// 瀑布流
						group = img.waterfall || []
						if(group.length > 0) {
							$(".waterfall").empty();
							$.each(group,function(index,item){
								s='<img src='+item.imgPath+'  json='+JSON.stringify(item)+'>';
								$(".waterfall").append(s);
							});  
						}
						// 分类
						group = img.listItem || []
						if(group.length > 0) {
							$(".list-item").empty();
							$.each(group,function(index,item){
								s='<img src='+item.imgPath+'  json='+JSON.stringify(item)+'>';
								$(".list-item").append(s);
							});  
						}
						// 有机棉
						cotton = img.cotton || {}
						if(cotton.imgPath) {
							if (cotton.detailList.length) {
								$(".cotton-list").empty();
								$.each(cotton.detailList,function(index,item){
									s='<img src='+item.imgPath+'  json='+JSON.stringify(item)+'>';
									$(".cotton-list").append(s);
								});  
							}
							$(".cotton-tip").empty();
							delete cotton.detailList
							s='<img src='+cotton.imgPath+' json='+JSON.stringify(cotton)+'>';
							$(".cotton-tip").append(s)
						}
						// 婴童
						baby = img.baby || {}
						if(baby.imgPath) {
							if (baby.detailList.length) {
								$(".baby-list").empty();
								$.each(baby.detailList,function(index,item){
									s='<img src='+item.imgPath+'  json='+JSON.stringify(item)+'>';
									$(".baby-list").append(s);
								});  
							}
							$(".baby-tip").empty();
							delete baby.detailList
							s='<img src='+baby.imgPath+' json='+JSON.stringify(baby)+'>';
							$(".baby-tip").append(s)
						}
						// 鞋帽
						shoesHats = img.shoesHats || {}
						if(shoesHats.imgPath) {
							if (shoesHats.detailList.length) {
								$(".shoesHats-list").empty();
								$.each(shoesHats.detailList,function(index,item){
									s='<img src='+item.imgPath+'  json='+JSON.stringify(item)+'>';
									$(".shoesHats-list").append(s);
								});  
							}
							$('.shoesHats-body').empty();
							s='<img src='+shoesHats.body.imgPath+' json='+JSON.stringify(shoesHats.body)+'>';
							$(".shoesHats-body").append(s)
							$(".shoesHats-tip").empty();
							delete shoesHats.body
							delete shoesHats.detailList
							s='<img src='+shoesHats.imgPath+' json='+JSON.stringify(shoesHats)+'>';
							$(".shoesHats-tip").append(s)
						}
						// 家居
						HomeFurnishing = img.HomeFurnishing || {}
						if(HomeFurnishing.imgPath) {
							if (HomeFurnishing.detailList.length) {
								$(".HomeFurnishing-list").empty();
								$.each(HomeFurnishing.detailList,function(index,item){
									s='<img src='+item.imgPath+'  json='+JSON.stringify(item)+'>';
									$(".HomeFurnishing-list").append(s);
								});  
							}
							$('.HomeFurnishing-body').empty();
							s='<img src='+HomeFurnishing.body.imgPath+' json='+JSON.stringify(HomeFurnishing.body)+'>';
							$(".HomeFurnishing-body").append(s)
							$(".HomeFurnishing-tip").empty();
							delete HomeFurnishing.body
							delete HomeFurnishing.detailList
							s='<img src='+HomeFurnishing.imgPath+' json='+JSON.stringify(HomeFurnishing)+'>';
							$(".HomeFurnishing-tip").append(s)
						}
						handleHover();
						setTimeout(function () {
							$('.sortArea').nestable();
							//图片点击
							$("img").click(function () {
								upImg($(this));
							});
						}, 2000);

					}
				}
			});

		}
		var saveImg = function (target) {
			img.linkUrl = $("[name=linkUrl]").val();

			if (img.linkUrl.indexOf("product.html") > 0) {
				img.imageType = "Product";
				var i = img.linkUrl.indexOf("?");
				var k = img.linkUrl.substr(i + 1, img.linkUrl.length).split("&");
				img.searchKey = k[0].replace("productId=", "");
			}
			if (img.linkUrl.indexOf("static") > 0) {
				img.imageType = "WebView";
				img.searchKey = "";
			}
			if (img.linkUrl.indexOf("group") > 0) {
				img.imageType = "Group";
				img.searchKey = "";
			}
			if (img.linkUrl.indexOf("seconds") > 0) {
				img.imageType = "Seconds";
				img.searchKey = "";
			}
			if (img.linkUrl.indexOf("soapshare") > 0) {
				img.imageType = "SoapShare";
				img.searchKey = "";
			}
			if (img.linkUrl.indexOf("type=category") > 0) {
				img.imageType = "Category";
				img.searchKey = "";
			}
			if (img.linkUrl.indexOf("type=lifecategory") > 0) {
				img.imageType = "Category";
				img.searchKey = "";
			}
			if (img.linkUrl.indexOf("special?basicattribute=") > 0) {
				var i = img.linkUrl.indexOf("=");
				var k = img.linkUrl.substr(i + 1, img.linkUrl.length);
				img.searchKey = k;
				img.imageType = "FilterList";

			}
			if (img.linkUrl.indexOf("life") > 0) {
				var i = img.linkUrl.indexOf("life");
				var k = img.linkUrl.substr(i + 1, img.linkUrl.length);
				img.searchKey = k;
				img.imageType = "LifeList";

			}
			if (img.linkUrl.indexOf("list.html") > 0) {
				img.imageType = "List";
				var i = img.linkUrl.indexOf("?");
				var k = img.linkUrl.substr(i + 1, img.linkUrl.length);
				img.searchKey = k;
				// var k=img.linkUrl.substr(i+1,img.linkUrl.length).split("&");			
				// img.searchKey=k[0].replace("tags=","").replace("key=","");
			}
			$(target).attr("src", img.imgPath);
			$(target).attr("json", JSON.stringify(img));
			$("#box-config").modal("hide");


		}
		var upImg = function (that) {
			target = that;
			var v=target.attr("json");
			var obj="";
			if(v){
				obj=JSON.parse(v);
				img.linkUrl = obj.linkUrl;
			}

			img.imgPath = target.attr("src");
			var size = target.attr("size");
			img.name = target.attr("name");

			//img.id = target.attr("id");
			img.areaName = target.closest(".row").attr("name")

			$(".imgName").html(img.name);
			$(".imgSize").html(size);
			$("[name='imagePath']").val(img.imgPath);
			$(".image_preview_default").empty().append("<img src='" + img.imgPath + "'/>");

			$("[name=linkUrl]").val(img.linkUrl);
			$(".progress").hide();
			upLoadImg();
			$(".bt-save").unbind("click").click(function () { saveImg(target) });
			$("#box-config").modal("show");
		}
		//删除图片
		var delImg = function () {
			var name = $(this).closest("li").find("img").attr("name");
			var src = $(this).closest("li").find("img").attr("src");
			var that = $(this).closest("li");

			$.confirm("确认删除此图片?", function () {
				$(that).remove();

			});

		}
		var handleHover = function () {
			$('.filter-content').hover(
				function () {
					var hoverContent = $(this).children('.hover-content');
					hoverContent.removeClass('fadeOut').addClass(
						'animated fadeIn').show();
				}, function () {
					var hoverContent = $(this).children('.hover-content');
					hoverContent.removeClass('fadeIn').addClass('fadeOut');
				});
			$(".hover-content").find(".fa-edit").unbind("click").click(
				function () {
					var that = $(this).closest("li").find("img");
					upImg(that);
				});
			$(".hover-content").find(".btn-danger").unbind("click").click(
				delImg);
		}
		var tip = '<div class="hover-content"><a class="btn btn-success hover-link"><i class="fa fa-edit fa-1x"></i></a>'
			+ '<a class="btn btn-danger hover-link colorbox-button" ><i class="fa fa-times fa-1x"></i></a></div>';
		var review = function () {
			var home = {};
			home.brand = {};
			home.brand = JSON.parse($("[name=brand]").attr("json"));
			home.vip = {};
			home.vip = JSON.parse($("[name='agent-vip']").attr("json"));
			// 瀑布流
			home.waterfall = []
			$(".waterfall").find("img").each(function (index, item) {
				home.waterfall.push(JSON.parse($(this).attr("json")));
			});
			home.listItem = []
			$(".list-item").find("img").each(function (index, item) {
				home.listItem.push(JSON.parse($(this).attr("json")));
			});
			// 有机棉
			home.cotton = JSON.parse($(".cotton-tip").find('img').attr("json"));
			home.cotton['detailList'] = []
			$(".cotton-list").find("img").each(function (index, item) {
				home.cotton.detailList.push(JSON.parse($(this).attr("json")));
			});
			// 婴童
			home.baby = JSON.parse($(".baby-tip").find('img').attr("json"));
			home.baby['detailList'] = []
			$(".baby-list").find("img").each(function (index, item) {
				home.baby.detailList.push(JSON.parse($(this).attr("json")));
			});
			// 鞋帽
			home.shoesHats = JSON.parse($(".shoesHats-tip").find('img').attr("json"));
			home.shoesHats['body'] = JSON.parse($(".shoesHats-body").find('img').attr("json"));
			home.shoesHats['detailList'] = []
			$(".shoesHats-list").find("img").each(function (index, item) {
				home.shoesHats.detailList.push(JSON.parse($(this).attr("json")));
			});
			// 家居
			home.HomeFurnishing = JSON.parse($(".HomeFurnishing-tip").find('img').attr("json"));
			home.HomeFurnishing['body'] = JSON.parse($(".HomeFurnishing-body").find('img').attr("json"));
			home.HomeFurnishing['detailList'] = []
			$(".HomeFurnishing-list").find("img").each(function (index, item) {
				home.HomeFurnishing.detailList.push(JSON.parse($(this).attr("json")));
			});
			//var s='{"group":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/4b22b9c5-2fd3-4a92-9c15-66be4b845d8b.jpg","name":"group","linkUrl":"http://m.yiigoo.com/product/product.html?productId=969","imageType":"Product","searchKey":"969","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/5110df50-1906-489d-a78f-b5f4c4a2d206.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=992","areaName":"groupList","imageType":"Product","searchKey":"992"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/2b6fdbef-f3b7-4049-b9e6-a3912e96a698.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=976","areaName":"groupList","imageType":"Product","searchKey":"976"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/acdd0dcb-73f1-4323-992c-ce468a115113.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=990","areaName":"groupList","imageType":"Product","searchKey":"990"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/0bd0c834-5f5d-47fe-8874-e1eef3a37110.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=979","areaName":"groupList","imageType":"Product","searchKey":"979"}]},"second":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/5fe27bc5-d43a-4528-b655-3d2e911ec16a.jpg","name":"second","linkUrl":"http://m.yiigoo.com/product/seconds.html?v=20180328","imageType":"Product","searchKey":"979","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/0acac4cb-1986-4986-8f80-9a8bc6eb4490.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","areaName":"secondList","imageType":"Product","searchKey":"1004"}]},"star":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/b1955d98-67a0-4c11-8751-98982589e93f.jpg","linkUrl":"http://m.yiigoo.com/static/1511439592.html","imageType":"WebView","searchKey":"","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/73114511-9fae-4193-8fae-dc6630e86c48.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","areaName":"starList","imageType":"Product","searchKey":"1004"}]},"selectList":[],"brandList":[],"hotSales":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/313cde18-3868-4f6b-8ee2-baa75769070d.jpg","name":"hotSales","linkUrl":"http://m.yiigoo.com/product/list.html?key=%E5%A4%8F%E8%A3%85&cname=%E5%A4%8F%E8%A3%85","imageType":"List","searchKey":"%E5%A4%8F%E8%A3%85","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/4ed2dff1-608f-4f33-9723-14d4fae39076.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=958","areaName":"hotSalesList","imageType":"Product","searchKey":"958"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/750343d0-2b89-43c9-a830-a9be62d70ef8.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=943","areaName":"hotSalesList","imageType":"Product","searchKey":"943"}]},"newProduct":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/284f9830-92e4-4d8b-9251-3b07ddbc26bc.jpg","name":"newProduct","linkUrl":"http://m.yiigoo.com/product/list.html?key=%E4%BA%B2%E5%AD%90&cname=%E4%BA%B2%E5%AD%90","imageType":"List","searchKey":"%E4%BA%B2%E5%AD%90","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/ac29a4c7-a83b-48a6-972f-96101648ae7d.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/963fa169-a324-4f15-877a-8613cc130d67.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/16d54fb4-2604-4c45-b40b-d67bf9b7632c.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/d17aa16c-a429-4cd2-972d-e5d10dd9d8ac.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/af02ad7a-5dbc-4f63-b37e-aff6059d85e3.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/ca324885-7b69-4ae2-894e-e45060c8a301.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"}]},"house":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/fd4f7ea4-324d-4b27-b40a-2ac8de5f8f52.jpg","name":"house","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/3d921521-9fd7-4ac2-9ee9-0baaab0854bd.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/c38f6cf0-df5f-4c57-a23e-7ccf414223f9.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/ca02cd75-02d4-4e36-85dc-27410502e414.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/6a3af7a7-7472-46e4-a33e-01262c7c9663.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/79aa67b5-6307-4cfc-9a7d-a279892d1182.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/a08aaff1-259a-4433-97d2-f78aaa5ae68f.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"}]}}';'
			setTimeout(function () {
				$.confirm("确认数据都已经上传，保存后请在列表中设置生效日期!", function () {
					var img = ''
					if (flag == 'edit') {
						img = JSON.stringify({
							id: id,
							imgType: 'Mall',
							imgPath: JSON.stringify(home)
						})
					} else {
						img = JSON.stringify({
							imgType: 'Mall',
							imgPath: JSON.stringify(home)
						})
					}
					$.ajax({
						type: "post",
						url: App.getContextPath() + "admin/template/saveImg.do",
						async: true,
						data: $.param({
							img: img
						}),
						success: function (result) {
							$.unblockUI();
							if (result.type == "success") {
								bootbox.dialog({
									message: '保存成功',
									title: "操作提示",
									buttons: {
										success: {
											label: "关闭",
											className: "btn-default",
											callback: function () {
												$(".bootbox").modal("hide");
												window.location.href = 'cms_controller.html'
											}
										}
									}
								});
							}

						}
					});
				})
			}, 1000);



		}
		return {
			init: function () {
				//加载图片
				loadImg();

				//图片点击
				$("img").click(function () {
					upImg($(this));
				});
				$(".bt_review").click(review);
				$(".bt_uploadK").click(function () {

					var tag = $(this).closest("div");
					$(tag).next().find("ul").append($("#divLi").html());
					//$("#divLi").html().appendTo($(tag).next().find("ol li:last-child"));
					$(tag).next().find("ul li:last-child img").click(upImg);
					$(tag).next().find("ul li:last-child button").click(delImg);
					handleHover();
					$('.sortArea').nestable();

				});
				//增加两个图片
				$(".bt_twoUploadK").click(function () {

					var tag = $("[name=newProductList]");
					var divli = $("#divLi").html();
					divli += $("#divLi").html()
					$(tag).append(divli);

					$(tag).find("li>img").click(upImg);
					$(tag).find("li>button").click(delImg);
					handleHover();
					$('.sortArea').nestable();

				});
				$(".savaSort").click(function () {
					var target = $(this).attr("data-areaname");
					var list = [];
					$("div[name=" + target + "]").find("img").each(function (index, item) {
						if (typeof $(this).attr("linkUrl") != "undefined") {
							var img = {};
							img.areaName = target;
							img.name = target.replace("tag", '') + (index + 1)
							img.imgPath = $(this).attr("src");
							img.linkUrl = $(this).attr("linkUrl");
							img.imgType = "Mall";
							list.push(img);
						}
					});
					if (list.length == 0) {
						$.alert("请先上传图片");
						return false;
					}

				});

			}
		}
	}();
	$(function () {
		$("#header").load("../head.html");
		App.init();
		Home.init();
	});
</script>


</html>